import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String A = in.nextLine();
        String B = in.nextLine();

        int diff = B.length() - A.length();
        int equ = 0;
        for(int i = 0; i <= diff; i++) {
            int count = 0;
            for(int j = 0; j < A.length(); j++) {
                char ch1 = A.charAt(j);
                char ch2 = B.charAt(i + j);
                if(ch1 == ch2) {
                    count++;
                }
            }
            equ = Math.max(equ, count);
        }

        System.out.println(B.length() - equ - diff);
    }
}